<!doctype html>



  


<html class="theme-next mist use-motion">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="集合," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.2" />






<meta name="description" content="&amp;#x5F15;&amp;#x8A00;:&amp;#x60F3;&amp;#x5230;&amp;#x5FAA;&amp;#x73AF;&amp;#x904D;&amp;#x5386;&amp;#x6570;&amp;#x7EC4;&amp;#x3001;&amp;#x5B57;&amp;#x5178;&amp;#x8FD9;&amp;#x4E9B;&amp;#x5E38;&amp;#x89C1;&amp;#x7684;&amp;#x96C6;&amp;#x5408;&amp;#xFF0C;&amp;#x5927;&amp;#x5BB6;&amp;#x8111;&amp;#x5B5">
<meta property="og:type" content="article">
<meta property="og:title" content="iOS开发 - 遍历集合(NSArray，NSDictionary、NSSet)方法总结">
<meta property="og:url" content="http://www.licheng244.com/posts/2016-10/31-1.html">
<meta property="og:site_name" content="LiCheng的博客">
<meta property="og:description" content="&amp;#x5F15;&amp;#x8A00;:&amp;#x60F3;&amp;#x5230;&amp;#x5FAA;&amp;#x73AF;&amp;#x904D;&amp;#x5386;&amp;#x6570;&amp;#x7EC4;&amp;#x3001;&amp;#x5B57;&amp;#x5178;&amp;#x8FD9;&amp;#x4E9B;&amp;#x5E38;&amp;#x89C1;&amp;#x7684;&amp;#x96C6;&amp;#x5408;&amp;#xFF0C;&amp;#x5927;&amp;#x5BB6;&amp;#x8111;&amp;#x5B5">
<meta property="og:updated_time" content="2017-10-09T06:31:16.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="iOS开发 - 遍历集合(NSArray，NSDictionary、NSSet)方法总结">
<meta name="twitter:description" content="&amp;#x5F15;&amp;#x8A00;:&amp;#x60F3;&amp;#x5230;&amp;#x5FAA;&amp;#x73AF;&amp;#x904D;&amp;#x5386;&amp;#x6570;&amp;#x7EC4;&amp;#x3001;&amp;#x5B57;&amp;#x5178;&amp;#x8FD9;&amp;#x4E9B;&amp;#x5E38;&amp;#x89C1;&amp;#x7684;&amp;#x96C6;&amp;#x5408;&amp;#xFF0C;&amp;#x5927;&amp;#x5BB6;&amp;#x8111;&amp;#x5B5">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Mist',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    }
  };
</script>




  <link rel="canonical" href="http://www.licheng244.com/posts/2016-10/31-1.html"/>


  <title> iOS开发 - 遍历集合(NSArray，NSDictionary、NSSet)方法总结 | LiCheng的博客 </title>
</head>

<body itemscope itemtype="//schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="//schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">LiCheng的博客</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle"></p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-lifes">
          <a href="/lifes" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-question-circle"></i> <br />
            
            生活
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup">
 <span class="search-icon fa fa-search"></span>
 <input type="text" id="local-search-input">
 <div id="local-search-result"></div>
 <span class="popup-btn-close">close</span>
</div>


    </div>
  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="//schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                iOS开发 - 遍历集合(NSArray，NSDictionary、NSSet)方法总结
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">发表于</span>
            <time itemprop="dateCreated" datetime="2016-10-31T00:00:00+08:00" content="2016-10-31">
              2016-10-31
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp;
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/iOS开发-OC/" itemprop="url" rel="index">
                    <span itemprop="name">iOS开发__OC</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
              <span class="post-comments-count">
                &nbsp; | &nbsp;
                <a href="/posts/2016-10/31-1.html#comments" itemprop="discussionUrl">
                  <span class="post-comments-count ds-thread-count" data-thread-key="posts/2016-10/31-1.html" itemprop="commentsCount"></span>
                </a>
              </span>
            
          


          

          
          
             <span id="/posts/2016-10/31-1.html" class="leancloud_visitors" data-flag-title="iOS开发 - 遍历集合(NSArray，NSDictionary、NSSet)方法总结">
               &nbsp; | &nbsp;
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               <span class="post-meta-item-text">阅读次数 </span>
               <span class="leancloud-visitors-count"></span>
              </span>
          

          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <blockquote>
<p><strong>&#x5F15;&#x8A00;:</strong><br>&#x60F3;&#x5230;&#x5FAA;&#x73AF;&#x904D;&#x5386;&#x6570;&#x7EC4;&#x3001;&#x5B57;&#x5178;&#x8FD9;&#x4E9B;&#x5E38;&#x89C1;&#x7684;&#x96C6;&#x5408;&#xFF0C;&#x5927;&#x5BB6;&#x8111;&#x5B50;&#x91CC;&#x7B2C;&#x4E00;&#x53CD;&#x5E94;&#x5C31;&#x662F;for&#x5FAA;&#x73AF;&#x548C;&#x5FEB;&#x901F;&#x904D;&#x5386;&#xFF0C;&#x5E76;&#x6D25;&#x6D25;&#x4E50;&#x9053;&#x7684;&#x4F20;&#x627F;&#x4F7F;&#x7528;&#x7740;&#x8FD9;&#x4E9B;&#x65B9;&#x6CD5;&#xFF0C;&#x8FD9;&#x4E9B;&#x5DF2;&#x7ECF;&#x8DB3;&#x591F;&#x6EE1;&#x8DB3;&#x5F00;&#x53D1;&#x4E2D;&#x6240;&#x6709;&#x7C7B;&#x4F3C;&#x7684;&#x9700;&#x6C42;&#xFF0C;&#x4F3C;&#x4E4E;&#x6CA1;&#x6709;&#x4EC0;&#x4E48;&#x9700;&#x8981;&#x603B;&#x7ED3;&#x7684;&#xFF0C;&#x5176;&#x5B9E;&#x4E0D;&#x7136;&#xFF0C;&#x4E0D;&#x4FE1;&#x5F80;&#x4E0B;&#x770B;&#xFF0C;&#x77E5;&#x9053;&#x7684;&#x5927;&#x795E;&#x5C31;&#x4E0D;&#x8981;&#x6D6A;&#x8D39;&#x65F6;&#x95F4;&#x4E86;&#x3002;</p>
</blockquote>
<a id="more"></a>
<p><a href="/posts/2016-10/28-2.html">xxxx</a></p>
<hr>
<h3 id="&#x4E00;-for&#x5FAA;&#x73AF;"><a href="#&#x4E00;-for&#x5FAA;&#x73AF;" class="headerlink" title="&#x4E00; for&#x5FAA;&#x73AF;"></a>&#x4E00; for&#x5FAA;&#x73AF;</h3><p>Objective-C&#x662F;&#x57FA;&#x4E8E;C&#x8BED;&#x8A00;&#x7684;&#xFF0C;&#x81EA;&#x7136;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;for&#x5FAA;&#x73AF;.</p>
<h4 id="&#x904D;&#x5386;&#x6570;&#x7EC4;&#xFF1A;"><a href="#&#x904D;&#x5386;&#x6570;&#x7EC4;&#xFF1A;" class="headerlink" title="&#x904D;&#x5386;&#x6570;&#x7EC4;&#xFF1A;"></a>&#x904D;&#x5386;&#x6570;&#x7EC4;&#xFF1A;</h4><figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">NSArray</span> *iosArray = @[<span class="string">@&quot;L&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;V&quot;</span>, <span class="string">@&quot;E&quot;</span>, <span class="string">@&quot;I&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;S&quot;</span>];</div><div class="line"><span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; iosArray.count; i++) {</div><div class="line">	<span class="comment">//&#x5904;&#x7406;&#x6570;&#x7EC4;&#x4E2D;&#x6570;&#x636E;</span></div><div class="line">	<span class="built_in">NSLog</span>(<span class="string">@&quot;%@&quot;</span>, iosArray[i]);</div><div class="line">}</div></pre></td></tr></table></figure>
<p>&#x904D;&#x5386;&#x6570;&#x7EC4;&#x5F88;&#x7B80;&#x5355;&#x6CA1;&#x95EE;&#x9898;&#xFF0C;&#x4E0B;&#x9762;&#x904D;&#x5386;&#x5B57;&#x5178;.</p>
<h4 id="&#x904D;&#x5386;&#x5B57;&#x5178;&#xFF1A;"><a href="#&#x904D;&#x5386;&#x5B57;&#x5178;&#xFF1A;" class="headerlink" title="&#x904D;&#x5386;&#x5B57;&#x5178;&#xFF1A;"></a>&#x904D;&#x5386;&#x5B57;&#x5178;&#xFF1A;</h4><figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">NSDictionary</span> *dict = @{<span class="string">@&quot;1&quot;</span>:<span class="string">@&quot;11&quot;</span>, <span class="string">@&quot;2&quot;</span>:<span class="string">@&quot;22&quot;</span>, <span class="string">@&quot;3&quot;</span>:<span class="string">@&quot;33&quot;</span>};</div><div class="line"><span class="built_in">NSArray</span> *keysArray = [dict allKeys];</div><div class="line"><span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; keysArray.count; i++) {</div><div class="line">	<span class="comment">//&#x6839;&#x636E;&#x952E;&#x503C;&#x5904;&#x7406;&#x5B57;&#x5178;&#x4E2D;&#x7684;&#x6BCF;&#x4E00;&#x9879;</span></div><div class="line">	<span class="built_in">NSString</span> *key = keysArray[i];</div><div class="line">	<span class="built_in">NSString</span> *value = dict[key];</div><div class="line">	<span class="built_in">NSLog</span>(<span class="string">@&quot;%@&quot;</span>, value);</div><div class="line">}</div></pre></td></tr></table></figure>
<p>&#x6211;&#x4EEC;&#x77E5;&#x9053;&#x5B57;&#x5178;&#x548C;set&#x662F;&#x65E0;&#x5E8F;&#x7684;&#xFF0C;&#x6240;&#x4EE5;&#x6211;&#x4EEC;&#x65E0;&#x6CD5;&#x6839;&#x636E;&#x7279;&#x5B9A;&#x7684;&#x6574;&#x6570;&#x4E0B;&#x6807;&#x6765;&#x76F4;&#x63A5;&#x8BBF;&#x95EE;&#x5176;&#x4E2D;&#x7684;&#x503C;&#xFF0C;&#x4E8E;&#x662F;&#x9700;&#x8981;&#x5148;&#x83B7;&#x53D6;&#x5B57;&#x5178;&#x4E2D;&#x7684;&#x952E;&#x6216;&#x8005;set&#x4E2D;&#x7684;&#x6240;&#x6709;&#x5BF9;&#x8C61;&#xFF0C;&#x8FD9;&#x6837;&#x5C31;&#x53EF;&#x4EE5;&#x5728;&#x83B7;&#x53D6;&#x5230;&#x7684;&#x6709;&#x5E8F;&#x6570;&#x7EC4;&#x4E0A;&#x8FDB;&#x884C;&#x904D;&#x5386;&#x4E86;&#x3002;&#x7136;&#x800C;&#x521B;&#x5EFA;&#x6570;&#x7EC4;&#x662F;&#x8981;&#x989D;&#x5916;&#x7684;&#x5F00;&#x9500;&#x7684;&#xFF0C;&#x8FD8;&#x4F1A;&#x591A;&#x521B;&#x5EFA;&#x51FA;&#x4E00;&#x4E2A;&#x6570;&#x7EC4;&#x5BF9;&#x8C61;&#xFF0C;&#x4ED6;&#x4F1A;&#x4FDD;&#x7559;collection&#x4E2D;&#x7684;&#x6240;&#x6709;&#x5BF9;&#x8C61;&#xFF0C;&#x5360;&#x7528;&#x4E86;&#x5185;&#x5B58;&#x3002;</p>
<h4 id="&#x603B;&#x7ED3;&#x4F18;&#x7F3A;&#x70B9;&#xFF1A;"><a href="#&#x603B;&#x7ED3;&#x4F18;&#x7F3A;&#x70B9;&#xFF1A;" class="headerlink" title="&#x603B;&#x7ED3;&#x4F18;&#x7F3A;&#x70B9;&#xFF1A;"></a>&#x603B;&#x7ED3;&#x4F18;&#x7F3A;&#x70B9;&#xFF1A;</h4><p>&#x4F18;&#x70B9;&#xFF1A;&#x88AB;&#x5E7F;&#x6CDB;&#x4F7F;&#x7528;&#xFF0C;&#x5BB9;&#x6613;&#x63A5;&#x53D7;&#xFF0C;&#x64CD;&#x4F5C;&#x7B80;&#x5355;&#xFF1B;<br>&#x7F3A;&#x70B9;&#xFF1A;&#x904D;&#x5386;&#x5B57;&#x5178;&#x548C;set&#x662F;&#x6BD4;&#x8F83;&#x7E41;&#x7410;&#xFF0C;&#x4F1A;&#x5360;&#x7528;&#x6BD4;&#x8F83;&#x591A;&#x7684;&#x7CFB;&#x7EDF;&#x8D44;&#x6E90;&#x3002;</p>
<hr>
<h3 id="&#x4E8C;-NSEnumerator"><a href="#&#x4E8C;-NSEnumerator" class="headerlink" title="&#x4E8C; NSEnumerator"></a>&#x4E8C; NSEnumerator</h3><p>NSEnumerator&#x662F;&#x4E00;&#x4E2A;&#x62BD;&#x8C61;&#x57FA;&#x7C7B;&#xFF0C;&#x5176;&#x4E2D;&#x5B9A;&#x4E49;&#x4E86;2&#x4E2A;&#x65B9;&#x6CD5;&#xFF0C;&#x4F7F;&#x5176;&#x5B50;&#x7C7B;&#x5B9E;&#x73B0;&#xFF1A;<br><code>- (nullable ObjectType)nextObject;</code><br><code>@property (readonly, copy) NSArray*allObjects;</code></p>
<p>&#x5176;&#x4E2D;<code>nextObject</code>&#x662F;&#x5173;&#x952E;&#x65B9;&#x6CD5;&#xFF0C;&#x5B83;&#x8FD4;&#x56DE;&#x679A;&#x4E3E;&#x91CC;&#x7684;&#x4E0B;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#x3002;&#x6BCF;&#x6B21;&#x8C03;&#x7528;&#x6539;&#x65B9;&#x6CD5;&#x5176;&#xFF0C;&#x5176;&#x5185;&#x90E8;&#x7ED3;&#x6784;&#x90FD;&#x4F1A;&#x66F4;&#x65B0;&#xFF0C;&#x4F7F;&#x5F97;&#x4E0B;&#x4E00;&#x6B21;&#x8C03;&#x7528;&#x65B9;&#x6CD5;&#x65F6;&#x80FD;&#x8FD4;&#x56DE;&#x4E0B;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#x3002;&#x7B49;&#x5230;&#x679A;&#x4E3E;&#x4E2D;&#x5168;&#x90E8;&#x7684;&#x5BF9;&#x8C61;&#x90FD;&#x5DF2;&#x7ECF;&#x8FD4;&#x56DE;&#x4E4B;&#x540E;&#xFF0C;&#x5728;&#x8C03;&#x7528;&#x5C31;&#x4F1A;&#x8FD4;&#x56DE;<code>nil</code>&#xFF0C;&#x8868;&#x793A;&#x8FBE;&#x5230;&#x4E86;&#x679A;&#x4E3E;&#x7684;&#x672B;&#x7AEF;&#x3002;</p>
<p><code>Foundation</code>&#x6846;&#x67B6;&#x4E2D;&#x7684;<code>collection</code>&#x90FD;&#x5B9E;&#x73B0;&#x4E86;&#x8FD9;&#x79CD;&#x904D;&#x5386;&#x65B9;&#x5F0F;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">NSArray</span> *iosArray = @[<span class="string">@&quot;L&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;V&quot;</span>, <span class="string">@&quot;E&quot;</span>, <span class="string">@&quot;I&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;S&quot;</span>];</div><div class="line"><span class="built_in">NSEnumerator</span> *enumerator = [iosArray objectEnumerator];<span class="comment">//&#x6B63;&#x5411;&#x904D;&#x5386;</span></div><div class="line"><span class="built_in">NSEnumerator</span> *enumerator = [iosArray reverseObjectEnumerator];<span class="comment">//&#x53CD;&#x5411;&#x904D;&#x5386;</span></div><div class="line"><span class="keyword">id</span> object;</div><div class="line"><span class="keyword">while</span> ((object = [enumerator nextObject]) != <span class="literal">nil</span>) {</div><div class="line">	<span class="comment">//&#x5904;&#x7406;&#x679A;&#x4E3E;&#x5668;&#x4E2D;&#x7684;&#x6570;&#x636E;</span></div><div class="line">	<span class="built_in">NSLog</span>(<span class="string">@&quot;%@&quot;</span>, object);</div><div class="line">}</div></pre></td></tr></table></figure>
<p>&#x5B57;&#x5178;&#x548C;set&#x5B9E;&#x73B0;&#x7684;&#x65B9;&#x5F0F;&#x76F8;&#x4F3C;&#xFF0C;&#x4E0D;&#x540C;&#x7684;&#x662F;&#x5B57;&#x5178;&#x4E2D;&#x6709;key&#x548C;value&#xFF0C;&#x8981;&#x6839;&#x636E;&#x5177;&#x4F53;&#x7684;key&#x53D6;&#x51FA;value&#x3002;&#x540C;&#x65F6;&#x63D0;&#x4F9B;&#x4E86;&#x6B63;&#x5411;&#x904D;&#x5386;&#x548C;&#x53CD;&#x5411;&#x904D;&#x5386;&#x3002;</p>
<h4 id="&#x603B;&#x7ED3;&#x4F18;&#x7F3A;&#x70B9;&#xFF1A;-1"><a href="#&#x603B;&#x7ED3;&#x4F18;&#x7F3A;&#x70B9;&#xFF1A;-1" class="headerlink" title="&#x603B;&#x7ED3;&#x4F18;&#x7F3A;&#x70B9;&#xFF1A;"></a>&#x603B;&#x7ED3;&#x4F18;&#x7F3A;&#x70B9;&#xFF1A;</h4><ul>
<li>&#x4F18;&#x70B9;&#xFF1A;<ul>
<li>&#x4EE3;&#x7801;&#x66F4;&#x6613;&#x8BFB;&#xFF0C;&#x4E0D;&#x9700;&#x8981;&#x5B9A;&#x4E49;&#x989D;&#x5916;&#x7684;&#x6570;&#x7EC4;&#xFF1B;</li>
</ul>
</li>
<li>&#x7F3A;&#x70B9;&#xFF1A;<ol>
<li>&#x65E0;&#x6CD5;&#x76F4;&#x63A5;&#x83B7;&#x53D6;&#x904D;&#x5386;&#x64CD;&#x4F5C;&#x7684;&#x4E0B;&#x6807;&#xFF0C;&#x9700;&#x8981;&#x53E6;&#x5916;&#x58F0;&#x660E;&#x53D8;&#x91CF;&#x8BB0;&#x5F55;&#xFF1B;</li>
<li>&#x9700;&#x8981;&#x81EA;&#x884C;&#x521B;&#x5EFA;NSEnumerator&#x5BF9;&#x8C61;&#xFF0C;&#x7A0D;&#x663E;&#x9EBB;&#x70E6;&#x3002;</li>
</ol>
</li>
</ul>
<hr>
<h3 id="&#x4E09;-&#x5FEB;&#x901F;&#x904D;&#x5386;"><a href="#&#x4E09;-&#x5FEB;&#x901F;&#x904D;&#x5386;" class="headerlink" title="&#x4E09; &#x5FEB;&#x901F;&#x904D;&#x5386;"></a>&#x4E09; &#x5FEB;&#x901F;&#x904D;&#x5386;</h3><p>Objective-C 2.0&#x5F15;&#x5165;&#x4E86;&#x5FEB;&#x901F;&#x904D;&#x5386;&#x8FD9;&#x4E00;&#x529F;&#x80FD;&#xFF0C;&#x5FEB;&#x901F;&#x904D;&#x5386;&#x4E0E;NSEnumerator&#x5DEE;&#x4E0D;&#x591A;&#xFF0C;&#x7136;&#x800C;&#x8BED;&#x6CD5;&#x66F4;&#x4E3A;&#x7B80;&#x6D01;&#xFF0C;&#x5B83;&#x4E3A;for&#x5FAA;&#x73AF;&#x5F00;&#x8BBE;&#x4E86;in&#x5173;&#x952E;&#x5B57;&#xFF0C;&#x7B80;&#x5316;&#x4E86;&#x904D;&#x5386;collection&#x6240;&#x9700;&#x7684;&#x8BED;&#x6CD5;&#xFF0C;&#x4F8B;&#x5982;:</p>
<h4 id="&#x904D;&#x5386;&#x6570;&#x7EC4;"><a href="#&#x904D;&#x5386;&#x6570;&#x7EC4;" class="headerlink" title="&#x904D;&#x5386;&#x6570;&#x7EC4;"></a>&#x904D;&#x5386;&#x6570;&#x7EC4;</h4><figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">NSArray</span> *iosArray = @[<span class="string">@&quot;L&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;V&quot;</span>, <span class="string">@&quot;E&quot;</span>, <span class="string">@&quot;I&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;S&quot;</span>];</div><div class="line"><span class="keyword">for</span> (<span class="built_in">NSString</span> *obj <span class="keyword">in</span> iosArray) {</div><div class="line">	<span class="comment">//&#x5904;&#x7406;&#x6570;&#x7EC4;&#x4E2D;&#x7684;&#x6570;&#x636E;</span></div><div class="line">	<span class="built_in">NSLog</span>(<span class="string">@&quot;%@&quot;</span>, obj);</div><div class="line">}</div></pre></td></tr></table></figure>
<h4 id="&#x904D;&#x5386;&#x5B57;&#x5178;"><a href="#&#x904D;&#x5386;&#x5B57;&#x5178;" class="headerlink" title="&#x904D;&#x5386;&#x5B57;&#x5178;"></a>&#x904D;&#x5386;&#x5B57;&#x5178;</h4><p>&#x4E5F;&#x540C;&#x6837;&#x7B80;&#x5355;&#xFF1A;<br><figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">NSDictionary</span> *dict = @{<span class="string">@&quot;1&quot;</span>:<span class="string">@&quot;11&quot;</span>, <span class="string">@&quot;2&quot;</span>:<span class="string">@&quot;22&quot;</span>, <span class="string">@&quot;3&quot;</span>:<span class="string">@&quot;33&quot;</span>};</div><div class="line"><span class="keyword">for</span> (<span class="built_in">NSString</span> *key <span class="keyword">in</span> dict) {</div><div class="line">	<span class="comment">//&#x5904;&#x7406;&#x5B57;&#x5178;&#x7684;&#x952E;&#x503C;</span></div><div class="line">	<span class="built_in">NSString</span> *value = dict[key];</div><div class="line">	<span class="built_in">NSLog</span>(<span class="string">@&quot;%@&quot;</span>, value);</div><div class="line">}</div></pre></td></tr></table></figure></p>
<p>&#x53CD;&#x5411;&#x904D;&#x5386;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;:<br><code>for (NSString *obj in [iosArray reverseObjectEnumerator])</code></p>
<p>####&#x603B;&#x7ED3;&#x4F18;&#x7F3A;&#x70B9;</p>
<p>&#x4F18;&#x70B9;&#xFF1A;<br>&#x8BED;&#x6CD5;&#x7B80;&#x6D01;&#xFF0C;&#x4F7F;&#x7528;&#x65B9;&#x4FBF;&#xFF0C;&#x6548;&#x7387;&#x9AD8;&#xFF1B;<br>&#x7F3A;&#x70B9;&#xFF1A;<br>    1&#x3001;&#x65E0;&#x6CD5;&#x65B9;&#x4FBF;&#x83B7;&#x53D6;&#x5F53;&#x524D;&#x904D;&#x5386;&#x7684;&#x4E0B;&#x6807;&#xFF1B;<br>    2&#x3001;&#x65E0;&#x6CD5;&#x5728;&#x904D;&#x5386;&#x8FC7;&#x7A0B;&#x4E2D;&#x4FEE;&#x6539;&#x88AB;&#x904D;&#x5386;&#x7684;collection&#xFF0C;&#x5426;&#x5219;&#x4F1A;&#x5BFC;&#x81F4;&#x5D29;&#x6E83;&#x3002;</p>
<hr>
<h3 id="&#x56DB;-&#x57FA;&#x4E8E;&#x5757;&#x7684;&#x904D;&#x5386;&#x65B9;&#x5F0F;"><a href="#&#x56DB;-&#x57FA;&#x4E8E;&#x5757;&#x7684;&#x904D;&#x5386;&#x65B9;&#x5F0F;" class="headerlink" title="&#x56DB; &#x57FA;&#x4E8E;&#x5757;&#x7684;&#x904D;&#x5386;&#x65B9;&#x5F0F;"></a>&#x56DB; &#x57FA;&#x4E8E;&#x5757;&#x7684;&#x904D;&#x5386;&#x65B9;&#x5F0F;</h3><p><b style="color:red">&#x8FD9;&#x624D;&#x662F;&#x672C;&#x6587;&#x7684;&#x91CD;&#x70B9;&#xFF0C;&#x4E5F;&#x662F;&#x7B14;&#x8005;&#x6781;&#x529B;&#x63A8;&#x8350;&#x4F7F;&#x7528;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x82F9;&#x679C;&#x5C01;&#x88C5;&#x4E86;&#x5982;&#x6B64;&#x9AD8;&#x6548;&#x3001;&#x4F18;&#x96C5;&#x3001;&#x6613;&#x7528;&#x7684;&#x4E00;&#x5957;&#x63A5;&#x53E3;&#x4E0D;&#x7528;&#x591A;&#x4E48;&#x6D6A;&#x8D39;&#x3002;</b></p>
<h4 id="&#x904D;&#x5386;&#x6570;&#x7EC4;-1"><a href="#&#x904D;&#x5386;&#x6570;&#x7EC4;-1" class="headerlink" title="&#x904D;&#x5386;&#x6570;&#x7EC4;"></a>&#x904D;&#x5386;&#x6570;&#x7EC4;</h4><figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">NSArray</span> *iosArray = @[<span class="string">@&quot;L&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;V&quot;</span>, <span class="string">@&quot;E&quot;</span>, <span class="string">@&quot;I&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;S&quot;</span>];</div><div class="line">[iosArray enumerateObjectsUsingBlock:^(<span class="keyword">id</span>  _Nonnull obj, <span class="built_in">NSUInteger</span> idx, <span class="built_in">BOOL</span> * _Nonnull stop) {</div><div class="line">	<span class="built_in">NSLog</span>(<span class="string">@&quot;%@&quot;</span>, obj);</div><div class="line">	<span class="keyword">if</span> ([obj isEqualToString:<span class="string">@&quot;E&quot;</span>]) {</div><div class="line">		*stop = <span class="literal">YES</span>;</div><div class="line">	}</div><div class="line">}];</div></pre></td></tr></table></figure>
<p>&#x53C2;&#x6570;&#x8BF4;&#x660E;&#xFF1A;<br><code>obj</code>&#x8868;&#x793A;&#x6570;&#x7EC4;&#x4E2D;&#x7684;&#x5143;&#x7D20;;<br><code>idx</code>&#x8868;&#x793A;&#x5143;&#x7D20;&#x7684;&#x4E0B;&#x6807;;<br><code>stop</code>&#x53EF;&#x4EE5;&#x63A7;&#x5236;&#x904D;&#x5386;&#x4F55;&#x65F6;&#x505C;&#x6B62;&#xFF0C;&#x5728;&#x9700;&#x8981;&#x505C;&#x6B62;&#x65F6;&#x4EE4;<code>*stop = YES</code>&#x5373;&#x53EF;&#xFF08;&#x4E0D;&#x8981;&#x5FD8;&#x8BB0;&#x524D;&#x9762;&#x7684;*&#xFF09;&#x3002;</p>
<p>&#x8FD9;&#x79CD;&#x65B9;&#x6CD5;&#x6E05;&#x6670;&#x660E;&#x4E86;&#xFF0C;&#x6570;&#x7EC4;&#x5143;&#x7D20;&#xFF0C;&#x4E0B;&#x6807;&#x90FD;&#x53EF;&#x76F4;&#x63A5;&#x83B7;&#x53D6;&#xFF0C;&#x5C31;&#x8FDE;&#x4F55;&#x65F6;&#x505C;&#x6B62;&#x90FD;&#x5F88;&#x5BB9;&#x6613;&#x5B9E;&#x73B0;&#xFF0C;break&#x90FD;&#x53EF;&#x4EE5;&#x9000;&#x4F11;&#x4E86;&#xFF0C;&#x904D;&#x5386;&#x5B57;&#x5178;&#x4E5F;&#x540C;&#x6837;&#x7B80;&#x5355;&#x3002;</p>
<h4 id="&#x904D;&#x5386;&#x5B57;&#x5178;-1"><a href="#&#x904D;&#x5386;&#x5B57;&#x5178;-1" class="headerlink" title="&#x904D;&#x5386;&#x5B57;&#x5178;"></a>&#x904D;&#x5386;&#x5B57;&#x5178;</h4><figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">NSDictionary</span> *dict = @{<span class="string">@&quot;1&quot;</span>:<span class="string">@&quot;11&quot;</span>, <span class="string">@&quot;2&quot;</span>:<span class="string">@&quot;22&quot;</span>, <span class="string">@&quot;3&quot;</span>:<span class="string">@&quot;33&quot;</span>};</div><div class="line">[dict enumerateKeysAndObjectsUsingBlock:^(<span class="keyword">id</span>  _Nonnull key, <span class="keyword">id</span>  _Nonnull obj, <span class="built_in">BOOL</span> * _Nonnull stop) {</div><div class="line">	<span class="built_in">NSLog</span>(<span class="string">@&quot;%@&quot;</span>, obj);</div><div class="line">	<span class="keyword">if</span> ([obj isEqualToString:<span class="string">@&quot;22&quot;</span>]) {</div><div class="line">	*stop = <span class="literal">YES</span>;</div><div class="line">	}</div><div class="line">}];</div></pre></td></tr></table></figure>
<p>&#x4F60;&#x6CA1;&#x6709;&#x770B;&#x9519;&#xFF0C;&#x5C31;&#x662F;&#x8FD9;&#x4E48;&#x7B80;&#x5355;&#xFF0C;block&#x76F4;&#x63A5;&#x628A;&#x5B57;&#x5178;&#x7684;key&#x548C;value&#x90FD;&#x7ED9;&#x6211;&#x4EEC;&#x4E86;&#xFF0C;&#x518D;&#x4E5F;&#x4E0D;&#x7528;&#x4E66;&#x5199;&#x76F4;&#x767D;&#x800C;&#x7E41;&#x7410;&#x7684;&#x4EE3;&#x7801;&#x4E86;&#x3002;</p>
<p><strong>&#x6CE8;&#x610F;&#xFF1A;</strong></p>
<blockquote>
<p>&#x82E5;&#x5DF2;&#x77E5;collection&#x91CC;&#x5BF9;&#x8C61;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;&#xFF0C;&#x53EF;&#x4EE5;&#x4FEE;&#x6539;&#x5757;&#x7B7E;&#x540D;&#xFF0C;&#x77E5;&#x9053;&#x5BF9;&#x8C61;&#x7684;&#x7CBE;&#x786E;&#x7C7B;&#x578B;&#x540E;&#xFF0C;&#x7F16;&#x8BD1;&#x5668;&#x5C31;&#x53EF;&#x4EE5;&#x68C0;&#x6D4B;&#x5F00;&#x53D1;&#x8005;&#x662F;&#x5426;&#x8C03;&#x7528;&#x4E86;&#x8BE5;&#x5BF9;&#x8C61;&#x6240;&#x4E0D;&#x5177;&#x6709;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x5E76;&#x5728;&#x53D1;&#x73B0;&#x95EE;&#x9898;&#x65F6;&#x62A5;&#x9519;&#x3002;</p>
</blockquote>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">NSDictionary</span> *dict = @{<span class="string">@&quot;1&quot;</span>:<span class="string">@&quot;11&quot;</span>, <span class="string">@&quot;2&quot;</span>:<span class="string">@&quot;22&quot;</span>, <span class="string">@&quot;3&quot;</span>:<span class="string">@&quot;33&quot;</span>};</div><div class="line">[dict enumerateKeysAndObjectsUsingBlock:^(<span class="built_in">NSString</span> *key, <span class="built_in">NSString</span> *obj, <span class="built_in">BOOL</span> * _Nonnull stop) {</div><div class="line">	<span class="built_in">NSLog</span>(<span class="string">@&quot;%@&quot;</span>, obj);</div><div class="line">	<span class="keyword">if</span> ([obj isEqualToString:<span class="string">@&quot;22&quot;</span>]) {</div><div class="line">		*stop = <span class="literal">YES</span>;</div><div class="line">	}</div><div class="line">}];</div></pre></td></tr></table></figure>
<p>&#x5982;&#x4EE3;&#x7801;&#xFF0C;&#x76F4;&#x63A5;&#x628A;key&#x548C;value&#x7684;&#x7C7B;&#x578B;&#x4FEE;&#x6539;&#x6210;NSString&#x7C7B;&#x578B;&#x3002;</p>
<h4 id="&#x53CD;&#x5411;&#x904D;&#x5386;"><a href="#&#x53CD;&#x5411;&#x904D;&#x5386;" class="headerlink" title="&#x53CD;&#x5411;&#x904D;&#x5386;"></a>&#x53CD;&#x5411;&#x904D;&#x5386;</h4><p>&#x53CD;&#x5411;&#x904D;&#x5386;&#x4E5F;&#x540C;&#x6837;&#x65B9;&#x4FBF;&#xFF0C;&#x8C03;&#x7528;&#x53E6;&#x5916;&#x4E00;&#x4E2A;&#x65B9;&#x6CD5;&#x5373;&#x53EF;&#xFF1A;</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">NSArray</span> *iosArray = @[<span class="string">@&quot;L&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;V&quot;</span>, <span class="string">@&quot;E&quot;</span>, <span class="string">@&quot;I&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;S&quot;</span>];</div><div class="line">[iosArray enumerateObjectsWithOptions:<span class="built_in">NSEnumerationReverse</span> usingBlock:^(<span class="built_in">NSString</span> *obj, <span class="built_in">NSUInteger</span> idx, <span class="built_in">BOOL</span> * _Nonnull stop) {</div><div class="line">	<span class="built_in">NSLog</span>(<span class="string">@&quot;%@&quot;</span>, obj);</div><div class="line">	<span class="keyword">if</span> ([obj isEqualToString:<span class="string">@&quot;E&quot;</span>]) {</div><div class="line">		*stop = <span class="literal">YES</span>;</div><div class="line">	}</div><div class="line">}];</div></pre></td></tr></table></figure>
<p>&#x8FD9;&#x4E2A;&#x65B9;&#x6CD5;&#x76F8;&#x5BF9;&#x4E8E;&#x6B63;&#x5411;&#x904D;&#x5386;&#x591A;&#x4E86;&#x4E00;&#x4E2A;&#x679A;&#x4E3E;&#x7C7B;&#x578B;&#x7684;&#x53C2;&#x6570;<code>NSEnumerationReverse</code>&#xFF0C;&#x6253;&#x5F00;&#x8FD9;&#x4E2A;&#x9009;&#x9879;&#x5C31;&#x53EF;&#x4EE5;&#x53CD;&#x5411;&#x904D;&#x5386;&#x4E86;&#x3002;</p>
<h4 id="&#x5E76;&#x53D1;&#x904D;&#x5386;"><a href="#&#x5E76;&#x53D1;&#x904D;&#x5386;" class="headerlink" title="&#x5E76;&#x53D1;&#x904D;&#x5386;"></a>&#x5E76;&#x53D1;&#x904D;&#x5386;</h4><p>&#x987A;&#x7740;&#x8FD9;&#x4E2A;&#x679A;&#x4E3E;&#x7C7B;&#x578B;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x5C31;&#x4F1A;&#x5F15;&#x51FA;&#x5757;&#x679A;&#x4E3E;&#x7684;&#x53E6;&#x4E00;&#x5927;&#x4F18;&#x52BF;&#xFF1A;&#x5E76;&#x53D1;&#x904D;&#x5386;&#xFF0C;&#x53C2;&#x6570;&#x662F;&#xFF1A;<code>NSEnumerationConcurrent</code>&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x53EF;&#x4EE5;&#x540C;&#x65F6;&#x904D;&#x5386;<code>collection</code>&#x4E2D;&#x7684;&#x51E0;&#x4E2A;&#x5143;&#x7D20;&#xFF0C;&#x5177;&#x4F53;&#x6570;&#x91CF;&#x6839;&#x636E;&#x7CFB;&#x7EDF;&#x8D44;&#x6E90;&#x800C;&#x5B9A;&#x3002;&#x8FD9;&#x6837;&#x4F1A;&#x5145;&#x5206;&#x5229;&#x7528;&#x7CFB;&#x7EDF;&#x8D44;&#x6E90;&#xFF0C;&#x9AD8;&#x6548;&#x5FEB;&#x6377;&#x7684;&#x5B8C;&#x6210;collection&#x7684;&#x904D;&#x5386;&#xFF0C;&#x7CFB;&#x7EDF;&#x5E95;&#x5C42;&#x4F1A;&#x901A;&#x8FC7;GCD&#x6765;&#x5904;&#x7406;&#x5E76;&#x53D1;&#x4E8B;&#x5B9C;&#xFF0C;&#x5F00;&#x53D1;&#x8005;&#x4E0D;&#x9700;&#x8981;&#x62C5;&#x5FC3;&#x5185;&#x5B58;&#x548C;&#x7EBF;&#x7A0B;&#xFF0C;&#x5176;&#x4ED6;&#x65B9;&#x5F0F;&#x82E5;&#x8981;&#x5B9E;&#x73B0;&#x9AD8;&#x6548;&#x7684;&#x5E76;&#x53D1;&#x904D;&#x5386;&#x5341;&#x5206;&#x6709;&#x96BE;&#x5EA6;&#x3002;&#x901A;&#x8FC7;&#x5757;&#x679A;&#x4E3E;&#x904D;&#x5386;&#xFF0C;&#x6539;&#x53D8;collection&#x5E76;&#x4E0D;&#x4F1A;&#x5F15;&#x8D77;&#x5D29;&#x6E83;&#xFF0C;&#x4EE3;&#x7801;&#x5982;&#x4E0B;&#xFF1A;</p>
<figure class="highlight objectivec"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div></pre></td><td class="code"><pre><div class="line"><span class="built_in">NSArray</span> *iosArray = @[<span class="string">@&quot;L&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;V&quot;</span>, <span class="string">@&quot;E&quot;</span>, <span class="string">@&quot;I&quot;</span>, <span class="string">@&quot;O&quot;</span>, <span class="string">@&quot;S&quot;</span>];</div><div class="line"><span class="built_in">NSMutableArray</span> *iosMutableArray = [<span class="built_in">NSMutableArray</span> arrayWithArray:iosArray];</div><div class="line">[iosMutableArray enumerateObjectsWithOptions:<span class="built_in">NSEnumerationConcurrent</span> usingBlock:^(<span class="built_in">NSString</span> *obj, <span class="built_in">NSUInteger</span> idx, <span class="built_in">BOOL</span> * _Nonnull stop) {</div><div class="line">	obj = [<span class="built_in">NSString</span> stringWithFormat:<span class="string">@&quot;_%@&quot;</span>, obj];</div><div class="line">	[iosMutableArray replaceObjectAtIndex:idx withObject:obj];</div><div class="line">	<span class="built_in">NSLog</span>(<span class="string">@&quot;%@&quot;</span>, obj);</div><div class="line">	<span class="keyword">if</span> ([obj isEqualToString:<span class="string">@&quot;_I&quot;</span>]) {</div><div class="line">		*stop = <span class="literal">YES</span>;</div><div class="line">	}</div><div class="line">}];</div></pre></td></tr></table></figure>
<h4 id="&#x4F18;&#x7F3A;&#x70B9;&#x603B;&#x7ED3;"><a href="#&#x4F18;&#x7F3A;&#x70B9;&#x603B;&#x7ED3;" class="headerlink" title="&#x4F18;&#x7F3A;&#x70B9;&#x603B;&#x7ED3;"></a>&#x4F18;&#x7F3A;&#x70B9;&#x603B;&#x7ED3;</h4><p><strong>&#x4F18;&#x70B9;&#xFF1A;</strong></p>
<ol>
<li>&#x53EF;&#x4EE5;&#x5B8C;&#x7F8E;&#x5B9E;&#x73B0;for&#x5FAA;&#x73AF;&#x7684;&#x6240;&#x6709;&#x529F;&#x80FD;&#xFF1B;   </li>
<li>&#x53EF;&#x4EE5;&#x65B9;&#x4FBF;&#x83B7;&#x53D6;&#x96C6;&#x5408;&#x4E2D;&#x7684;&#x6BCF;&#x4E00;&#x9879;&#x5143;&#x7D20;&#xFF1B;  </li>
<li>&#x63D0;&#x4F9B;&#x4E86;&#x5FAA;&#x73AF;&#x904D;&#x5386;&#x7684;&#x53C2;&#x6570;&#xFF0C;NSEnumerationReverse&#x7528;&#x6765;&#x5B9E;&#x73B0;&#x5012;&#x5E8F;&#x5FAA;&#x73AF;&#x3002;NSEnumerationConcurrent&#x7528;&#x6765;&#x5B9E;&#x73B0;&#x5E76;&#x53D1;&#x904D;&#x5386;&#xFF0C;&#x4E24;&#x4E2A;&#x53C2;&#x6570;&#x53EF;&#x4EE5;&#x540C;&#x65F6;&#x4F7F;&#x7528;&#xFF1B;   </li>
<li>&#x8FD9;&#x79CD;&#x5FAA;&#x73AF;&#x65B9;&#x5F0F;&#x6548;&#x7387;&#x9AD8;&#xFF0C;&#x80FD;&#x591F;&#x63D0;&#x5347;&#x7A0B;&#x5E8F;&#x6027;&#x80FD;&#xFF0C;&#x5F00;&#x53D1;&#x8005;&#x53EF;&#x4EE5;&#x4E13;&#x6CE8;&#x4E8E;&#x4E1A;&#x52A1;&#x903B;&#x8F91;&#xFF0C;&#x800C;&#x4E0D;&#x5FC5;&#x62C5;&#x5FC3;&#x5185;&#x5B58;&#x548C;&#x7EBF;&#x7A0B;&#x7684;&#x95EE;&#x9898;&#xFF1B;  </li>
<li>&#x5F53;&#x5F00;&#x542F;NSEnumerationConcurrent&#x9009;&#x9879;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;for&#x5FAA;&#x73AF;&#x548C;&#x5FEB;&#x901F;&#x904D;&#x5386;&#x65E0;&#x6CD5;&#x8F7B;&#x6613;&#x5B9E;&#x73B0;&#x7684;&#x5E76;&#x53D1;&#x5FAA;&#x73AF;&#x529F;&#x80FD;&#xFF0C;&#x7CFB;&#x7EDF;&#x5E95;&#x5C42;&#x4F1A;&#x901A;&#x8FC7;GCD&#x5904;&#x7406;&#x5E76;&#x53D1;&#x4E8B;&#x5B9C;&#xFF0C;&#x8FD9;&#x6837;&#x53EF;&#x4EE5;&#x5145;&#x5206;&#x5229;&#x7528;&#x7CFB;&#x7EDF;&#x548C;&#x786C;&#x4EF6;&#x8D44;&#x6E90;&#xFF0C;&#x8FBE;&#x5230;&#x6700;&#x4F18;&#x7684;&#x904D;&#x5386;&#x6548;&#x679C;&#xFF1B; </li>
<li>&#x53EF;&#x4EE5;&#x4FEE;&#x6539;&#x5757;&#x7B7E;&#x540D;&#xFF0C;&#x5F53;&#x6211;&#x4EEC;&#x5DF2;&#x7ECF;&#x660E;&#x786E;&#x96C6;&#x5408;&#x4E2D;&#x7684;&#x5143;&#x7D20;&#x7C7B;&#x578B;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x628A;&#x9ED8;&#x8BA4;&#x7684;&#x7B7E;&#x540D;id&#x7C7B;&#x578B;&#x4FEE;&#x6539;&#x6210;&#x5DF2;&#x77E5;&#x7C7B;&#x578B;&#xFF0C;&#x6BD4;&#x5982;&#x5E38;&#x89C1;&#x7684;NSString&#xFF0C;&#x8FD9;&#x6837;&#x65E2;&#x53EF;&#x4EE5;&#x8282;&#x7701;&#x7CFB;&#x7EDF;&#x8D44;&#x6E90;&#x5F00;&#x9500;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x9632;&#x6B62;&#x8BEF;&#x5411;&#x5BF9;&#x8C61;&#x53D1;&#x9001;&#x4E0D;&#x5B58;&#x5728;&#x7684;&#x65B9;&#x6CD5;&#x662F;&#x5F15;&#x8D77;&#x7684;&#x5D29;&#x6E83;&#x3002;  </li>
</ol>
<p><strong>&#x7F3A;&#x70B9;: </strong></p>
<ol>
<li>&#x5F88;&#x591A;&#x5F00;&#x53D1;&#x8005;&#x4E0D;&#x77E5;&#x9053;&#x8FD9;&#x79CD;&#x904D;&#x5386;&#x65B9;&#x5F0F;&#xFF1B;</li>
<li>&#x8FD9;&#x91CC;&#x4F7F;&#x7528;&#x4E86;block&#xFF0C;&#x9700;&#x8981;&#x6CE8;&#x610F;&#x5728;block&#x91CC;&#x5BB9;&#x6613;&#x5F15;&#x8D77;&#x7684;&#x4FDD;&#x7559;&#x73AF;&#x95EE;&#x9898;&#xFF0C;&#x6BD4;&#x5982;&#x4F7F;&#x7528;self&#x8C03;&#x7528;&#x65B9;&#x6CD5;&#x65F6;&#xFF0C;&#x628A;self&#x8F6C;&#x5316;&#x6210;&#x82E5;&#x5F15;&#x7528;&#x5373;&#x53EF;&#x6253;&#x7834;&#x4FDD;&#x7559;&#x73AF;&#x3002;&#x5982;&#xFF1A;<strong>weak `</strong>typeof(self)weakSelf = self<code>&#x6216;&#x8005;</code> __weak MyController *weakSelf = self;` &#x5728;block&#x91CC;&#x4F7F;&#x7528;weakSelf&#x5373;&#x53EF;&#x3002;</li>
</ol>
<h3 id="&#x6CE8;&#x610F;"><a href="#&#x6CE8;&#x610F;" class="headerlink" title="&#x6CE8;&#x610F;"></a>&#x6CE8;&#x610F;</h3><p>&#x4F7F;&#x7528;&#x57FA;&#x4E8E;&#x5757;&#x7684;&#x904D;&#x5386;&#x65F6;&#x662F;&#x53EF;&#x4EE5;&#x4FEE;&#x6539;&#x904D;&#x5386;&#x7684;&#x5143;&#x7D20;&#x7684;&#xFF0C;&#x4E0D;&#x4F1A;&#x5BFC;&#x81F4;&#x5D29;&#x6E83;&#xFF0C;&#x4F46;&#x662F;&#x5982;&#x679C;&#x8981;&#x5220;&#x9664;&#x904D;&#x5386;&#x7684;&#x5143;&#x7D20;&#x4F1A;&#x5BFC;&#x81F4;&#x540E;&#x9762;&#x7684;&#x5143;&#x7D20;&#x65E0;&#x6CD5;&#x904D;&#x5386;&#x800C;&#x5D29;&#x6E83;&#xFF0C;&#x89E3;&#x51B3;&#x529E;&#x6CD5;&#x6709;2&#x79CD;:</p>
<ul>
<li>&#x4E00;&#x79CD;&#x662F;&#x590D;&#x5236;&#x4E00;&#x4EFD;&#x539F;&#x96C6;&#x5408;&#x7684;&#x526F;&#x672C;&#xFF0C;&#x5BF9;&#x526F;&#x672C;&#x8FDB;&#x884C;&#x64CD;&#x4F5C;&#xFF0C;&#x627E;&#x51FA;&#x6240;&#x8981;&#x64CD;&#x4F5C;&#x7684;&#x5143;&#x7D20;&#x540E;&#x518D;&#x5904;&#x7406;&#x539F;&#x96C6;&#x5408;&#xFF1B;</li>
<li>&#x4F7F;&#x7528;&#x53CD;&#x5411;&#x904D;&#x5386;&#xFF0C;&#x53CD;&#x5411;&#x904D;&#x5386;&#x5220;&#x9664;&#x5143;&#x7D20;&#x540E;&#x4E0D;&#x4F1A;&#x5BFC;&#x81F4;&#x5D29;&#x6E83;&#x3002;</li>
</ul>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/集合/" rel="tag">#集合</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/posts/2016-10/28-1.html" rel="next" title="iOS开发 - APP 跳转到相应的设置界面">
                <i class="fa fa-chevron-left"></i> iOS开发 - APP 跳转到相应的设置界面
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/posts/2016-11/01-1.html" rel="prev" title="iOS开发 - 关于 pch 文件的创建与配置">
                iOS开发 - 关于 pch 文件的创建与配置 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>





    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div class="ds-thread" data-thread-key="posts/2016-10/31-1.html"
           data-title="iOS开发 - 遍历集合(NSArray，NSDictionary、NSSet)方法总结" data-url="http://www.licheng244.com/posts/2016-10/31-1.html">
      </div>
    

        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="//schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/uploads/avatar.jpg"
               alt="Li Cheng" />
          <p class="site-author-name" itemprop="name">Li Cheng</p>
          <p class="site-description motion-element" itemprop="description">| 写写代码 | 做做设计 | <br>记录着工作和学习中的点点滴滴 ~~~</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">17</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">8</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">13</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#一-for循环"><span class="nav-number">1.</span> <span class="nav-text">一 for循环</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#遍历数组："><span class="nav-number">1.1.</span> <span class="nav-text">遍历数组：</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#遍历字典："><span class="nav-number">1.2.</span> <span class="nav-text">遍历字典：</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#总结优缺点："><span class="nav-number">1.3.</span> <span class="nav-text">总结优缺点：</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#二-NSEnumerator"><span class="nav-number">2.</span> <span class="nav-text">二 NSEnumerator</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#总结优缺点：-1"><span class="nav-number">2.1.</span> <span class="nav-text">总结优缺点：</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#三-快速遍历"><span class="nav-number">3.</span> <span class="nav-text">三 快速遍历</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#遍历数组"><span class="nav-number">3.1.</span> <span class="nav-text">遍历数组</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#遍历字典"><span class="nav-number">3.2.</span> <span class="nav-text">遍历字典</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#四-基于块的遍历方式"><span class="nav-number">4.</span> <span class="nav-text">四 基于块的遍历方式</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#遍历数组-1"><span class="nav-number">4.1.</span> <span class="nav-text">遍历数组</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#遍历字典-1"><span class="nav-number">4.2.</span> <span class="nav-text">遍历字典</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#反向遍历"><span class="nav-number">4.3.</span> <span class="nav-text">反向遍历</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#并发遍历"><span class="nav-number">4.4.</span> <span class="nav-text">并发遍历</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#优缺点总结"><span class="nav-number">4.5.</span> <span class="nav-text">优缺点总结</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#注意"><span class="nav-number">5.</span> <span class="nav-text">注意</span></a></li></ol></div>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Li Cheng</span>
</div>

<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>

        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.2"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.2"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.2"></script>



  

  
    
  

  <script type="text/javascript">
    var duoshuoQuery = {short_name:"licheng244344094"};
    (function() {
      var ds = document.createElement('script');
      ds.type = 'text/javascript';ds.async = true;
      ds.id = 'duoshuo-script';
      ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
      ds.charset = 'UTF-8';
      (document.getElementsByTagName('head')[0]
      || document.getElementsByTagName('body')[0]).appendChild(ds);
    })();
  </script>

  
    
    <script src="/lib/ua-parser-js/dist/ua-parser.min.js?v=0.7.9"></script>
    <script src="/js/src/hook-duoshuo.js"></script>
  






  
  
  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length == 0) {
       search_path = "search.xml";
    }
    var path = "/" + search_path;
    // monitor main search box;

    function proceedsearch() {
      $("body").append('<div class="popoverlay">').css('overflow', 'hidden');
      $('.popup').toggle();

    }
    // search function;
    var searchFunc = function(path, search_id, content_id) {
    'use strict';
    $.ajax({
        url: path,
        dataType: "xml",
        async: true,
        success: function( xmlResponse ) {
            // get the contents from search data
            isfetched = true;
            $('.popup').detach().appendTo('.header-inner');
            var datas = $( "entry", xmlResponse ).map(function() {
                return {
                    title: $( "title", this ).text(),
                    content: $("content",this).text(),
                    url: $( "url" , this).text()
                };
            }).get();
            var $input = document.getElementById(search_id);
            var $resultContent = document.getElementById(content_id);
            $input.addEventListener('input', function(){
                var matchcounts = 0;
                var str='<ul class=\"search-result-list\">';
                var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
                $resultContent.innerHTML = "";
                if (this.value.trim().length > 1) {
                // perform local searching
                datas.forEach(function(data) {
                    var isMatch = false;
                    var content_index = [];
                    var data_title = data.title.trim().toLowerCase();
                    var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase();
                    var data_url = decodeURIComponent(data.url);
                    var index_title = -1;
                    var index_content = -1;
                    var first_occur = -1;
                    // only match artiles with not empty titles and contents
                    if(data_title != '') {
                        keywords.forEach(function(keyword, i) {
                            index_title = data_title.indexOf(keyword);
                            index_content = data_content.indexOf(keyword);
                            if( index_title >= 0 || index_content >= 0 ){
                                isMatch = true;
								if (i == 0) {
                                    first_occur = index_content;
                                }
                            } 
							
                        });
                    }
                    // show search results
                    if (isMatch) {
                        matchcounts += 1;
                        str += "<li><a href='"+ data_url +"' class='search-result-title'>"+ data_title +"</a>";
                        var content = data.content.trim().replace(/<[^>]+>/g,"");
                        if (first_occur >= 0) {
                            // cut out 100 characters
                            var start = first_occur - 20;
                            var end = first_occur + 80;
                            if(start < 0){
                                start = 0;
                            }
                            if(start == 0){
                                end = 50;
                            }
                            if(end > content.length){
                                end = content.length;
                            }
                            var match_content = content.substring(start, end);
                            // highlight all keywords
                            keywords.forEach(function(keyword){
                                var regS = new RegExp(keyword, "gi");
                                match_content = match_content.replace(regS, "<b class=\"search-keyword\">"+keyword+"</b>");
                            });

                            str += "<p class=\"search-result\">" + match_content +"...</p>"
                        }
                        str += "</li>";
                    }
                })};
                str += "</ul>";
                if (matchcounts == 0) { str = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' }
                if (keywords == "") { str = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' }
                $resultContent.innerHTML = str;
            });
            proceedsearch();
        }
    });}

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched == false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };

    });

    $('.popup-btn-close').click(function(e){
      $('.popup').hide();
      $(".popoverlay").remove();
      $('body').css('overflow', '');
    });
    $('.popup').click(function(e){
      e.stopPropagation();
    });
  </script>


  

  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
  <script>AV.initialize("SJtE0CaYCSQVrkVXmWMYWJOd-gzGzoHsz", "TfVyU54NEToMYg0SId3KELgz");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  


</body>
</html>
